interface Child {
  id: number;
  pid: number;
  status: number;
  type: number;
  code: string;
  name: string;
  identification?: any;
  url: string;
  icon: string;
  memo?: any;
  sort: number;
  creator_id: number;
  updater_id: number;
  created_at: string;
  updated_at: string;
  children: any[];
}
// 请求响应参数（不包含data）
export interface Result {
  code: string;
  msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  forEach(arg0: (item: any) => void): unknown;
  length: number;
  data: T;
  // 添加 concat 方法
  concat: (arr: any) => any;
  map: (arr: any) => any;
}

// 分页响应参数
export interface ResPage<T> {
  list: T[];
  page: number;
  pageSize: number;
  total: number;
}

// 分页响应参数
export interface pageResData<T> {
  data: T[];
  current_page: number;
  // data: Datum[];
  first_page_url: string;
  from: number;
  last_page: number;
  last_page_url: string;
  next_page_url: string;
  path: string;
  per_page: number;
  prev_page_url: string;
  to: number;
  total: number;
}

// 分页请求参数
export interface ReqPage {
  page: number;
  pageSize: number;
}

// 分页请求参数
export interface ReqPage {
  page: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string;
    password: string;
  }
  export interface ResLogin {
    access_token: string;
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// Tree登录模块
export namespace TreeLogin {
  export interface ReqLoginForm {
    account: string;
    password: string;
  }
  export interface ResLogin {
    id: number;
    account: string;
    code: string;
    name: string;
    mobile?: any;
    token?: string;
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// 树返回模块
export namespace Tree {
  export interface ReqAreaParams extends ReqPage {
    id: number;
    status: number;
    code: string;
    name: string;
    latitude?: string;
    longitude?: string;
    memo?: string;
    sort: number;
    creator_id: number;
    updater_id: number;
    created_at: string[];
    updated_at: string[];
  }
  // 返回区域列表
  export interface ResAreaList {
    id: number;
    status: number;
    code: string;
    name: string;
    latitude: string;
    longitude: string;
    memo: string;
    sort: number;
    creator_id: number;
    updater_id: number;
    created_at: string[];
    updated_at: string[];
  }

  export interface Area {
    id: number;
    status: number;
    code: string;
    name: string;
    province: string;
    city: string;
    district: string;
    address: string;
    latitude: string;
    longitude: string;
    memo: null;
    sort: number;
    creator_id: number;
    updater_id: number;
    created_at: string;
    updated_at: string;
    creator_name: string;
    updater_name: string;
    planting_area_tree_count: number;
    planting_area_tree_id_array: number[];
  }

  //返回树种列表
  export interface ResTreeList {
    id: number;
    status: number;
    code: string;
    name: string;
    picture_path: string;
    memo?: any;
    sort: number;
    creator_id: number;
    updater_id: number;
    created_at: string;
    updated_at: string;
    creator_name: string;
    updater_name: string;
    planting_tree_specification_count: number;
  }

  // 返回规格列表
  export interface ResSpecList {
    id: number;
    planting_tree_id: number;
    status: number;
    code: string;
    name: string;
    donate_amount: string;
    memo?: string;
    sort: number;
    creator_id: number;
    updater_id: number;
    created_at: string;
    updated_at: string;
    creator_name: string;
    updater_name: string;
    planting_tree_name: string;
  }

  // 返回捐赠记录列表
  export interface ResRecordList {
    id: number;
    openid_mp: string;
    pay_status: number;
    out_trade_no: string;
    pay_at: string;
    prepay_id: string;
    donate_at: string;
    donate_total: string;
    donate_number: number;
    donate_amount: string;
    type: number;
    name: string;
    contact_information?: any;
    planting_area_id: number;
    planting_area_name: string;
    planting_tree_id: number;
    planting_tree_name: string;
    planting_tree_specification_id: number;
    planting_tree_specification_name: string;
    created_at: string;
    updated_at: string;
  }

  // 返回菜单列表
  export interface ResMenuList {
    id: number;
    pid: number;
    status: number;
    type: number;
    code: string;
    name: string;
    identification?: any;
    url: string;
    icon: string;
    memo: string;
    sort: number;
    creator_id: number;
    updater_id: number;
    created_at: string;
    updated_at: string;
    children: Child[];
  }
}

// 用户模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    // search_key: {
    name?: string;
    address?: string;
    status?: number;
    account?: string;
    mobile?: string;
    memo?: string;
    sort?: number;
    created_at?: string[];
    updated_at?: string[];
    // };
  }
  //返回用户列表
  export interface ResUserList {
    id: number;
    status: number;
    account: string;
    code: string;
    name: string;
    mobile?: any;
    password?: string;
    memo?: any;
    creator_id: number;
    updater_id: number;
    created_at: string[];
    updated_at: string[];
  }

  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }
  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }
  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
}
// 树模块
export namespace Tree {
  export interface ReqSpecParams extends ReqPage {
    // search_key: {
    planting_tree_id: number;
    name: string;
    planting_tree_name: string;
    status: number;
    donate_amount?: number;
    memo?: string;
    sort: number;
    created_at: string[];
    updated_at: string[];
    // };
  }

  export interface ReqRecordParams extends ReqPage {
    id: number;
    openid_mp: string;
    pay_status: number;
    out_trade_no: string;
    pay_at: string;
    prepay_id: string;
    donate_at: string;
    donate_total: string;
    donate_number: number;
    donate_amount: string;
    type: number;
    name: string;
    contact_information?: any;
    planting_area_id: number;
    planting_area_name: string;
    planting_tree_id: number;
    planting_tree_name: string;
    planting_tree_specification_id: number;
    planting_tree_specification_name: string;
    created_at: string;
    updated_at: string;
  }
  export interface ReqTreeParams extends ReqPage {
    // search_key: {
    status?: number;
    type?: number;
    name?: string;
    picture_path?: string;
    memo?: string;
    sort?: number;
    creator_id?: number;
    updater_id?: number;
    created_at?: string;
    updated_at?: string;
    creator_name?: string;
    updater_name?: string;
  }
  export interface ReqAreaParams extends ReqPage {
    id: number;
    status: number;
    account: string;
    code: string;
    name: string;
    mobile?: any;
    memo?: string;
    creator_id: number;
    updater_id: number;
    created_at: string[];
    updated_at: string[];
  }

  export interface ReqUserManageParams extends ReqPage {
    id: number;
    status: number;
    account: string;
    code: string;
    name: string;
    mobile?: any;
    memo?: any;
    created_at: string;
    updated_at: string;
  }

  // 菜单全树
  export interface menuObject {
    id: number;
    menu_ids?: number[];
    pid: number | string[];
    status: number;
    type: number;
    code?: string;
    name: string;
    identification?: string;
    url: string;
    path?: string;
    component?: string;
    icon?: string;
    memo: string;
    sort?: number;
    creator_id: number;
    updater_id: number;
    created_at: string;
    updated_at: string;
    children: Child[];
  }

  export interface Child {
    id: number;
    pid: number;
    status: number;
    type: number;
    code?: string;
    name: string;
    identification?: string;
    url: string;
    icon?: string;
    memo?: string;
    sort?: number;
    creator_id: number;
    updater_id: number;
    created_at: string;
    updated_at: string;
    children: any[];
  }
}
